
package fileby.model.impl.sources;

import fileby.core.SourceType;
import fileby.core.IDisplayableFileSource;
import java.util.ArrayList;

/**
 *
 * @author Ludwig
 */
public interface IFileSourceManager {

    public void switchCurrentSourceIndex(int index);

    /**
     * Creates a new source, of the specified type.
     * @param sourceType
     * @return The new IDisplayableSource
     */
    public IDisplayableFileSource newSource(SourceType sourceType);

    /**
     * Creates a new foldersource and either replaces an old one or simply adds it.
     * @param path The path to the folder.
     * @param replace True if this source replaces the current source.
     * @return The new source.
     */
    public IDisplayableFileSource newSource(String path, boolean replace)
            throws NullPointerException;

    public void switchCurrentSource(SourceType source, boolean replace)
            throws NullPointerException;

    /**
     * Removes the source.
     * @param index index of the source to be removed
     * @return true if it was removed successfully, otherwise false.
     */
    public boolean removeSource(int index);

    public int getCurrentSourceIndex();

    /**
     * Sets the specified file either selected or unselected.
     * @param path Pathname to the file.
     * @param select True if the file is to be selected, otherwise unselected.
     */
    public void setSelected(String path, boolean select);

    /**
     * Sets all items in current source selected or unselected.
     * @param select True if everything is to be selected, otherwise deselect all.
     */
    public void setAllSelected(boolean select);

    /**
     * Sets a single file selected, deselects the rest.
     * @param path
     */
    public void setSingleSelected(String path);

    public ArrayList<FileItem> getFileItems();

    /**
     *
     * @return the current IDisplayableSource.
     */
    public IFileSource getCurrentSource();

    public IFileSource getSource(int index);

    public ArrayList<IDisplayableFileSource> getSources();

    public IDisplayableFileSource searchInCurrentSource(String text);

    public String getAbsolutePathOf(IDisplayableFileSource source);
}
